package com.gzbugu.polytechsasia;

import org.junit.BeforeClass;

import com.gzbugu.polytechsasia.dao.DatabaseLinkDAO;
import com.gzbugu.polytechsasia.dao.IUserDAO;
import com.gzbugu.polytechsasia.dao.impl.UserDAO;
import com.gzbugu.polytechsasia.factory.ServiceFactory;
import com.gzbugu.polytechsasia.vo.User;

public class Test {

	@BeforeClass
	public static void setUpBeforeClass() throws Exception {
	}

	@org.junit.Test
	public void testConnection() {
		DatabaseLinkDAO.getConnection();
	}

	@org.junit.Test
	public void testDao() throws Exception {
		IUserDAO userDao = new UserDAO();
		User user = userDao.findByPassport("1");
		System.out.println(user.getId() + " " + user.getPassport() + " "
				+ user.getPassword());
		userDao.save(user);
	}
	
	@org.junit.Test
	public void testShowArticleService(){
		ServiceFactory.getShowArticleService().findAllTitleJSON(0,1,10);
		ServiceFactory.getShowArticleService().findArticleJSONById(40);
	}
	
	@org.junit.Test
	public void testRegx(){
		System.out.println("10".matches("[0-9]+"));
	}

}
